/* 
 * File:   gameScr.h
 * Author: cow
 *
 * Created on March 7, 2011, 12:54 PM
 */

#ifndef _GAMESCR_H
#define	_GAMESCR_H

//stdincludes-------------------------
#include <sigc++/sigc++.h>
#include <gtkmm/menu.h>
using namespace std;

//prototypes---------------------------
namespace mapdisplay{
class mapDisplay;
class infoDisplay;
class controll;
}

//defines------------------------------
namespace mapdisplay{
enum direction{ up = 0, down, left, right};
}


//includes-----------------------------
#include "../fleets/unit.h"
#include "../graphics/widgetSwap.h"
#include "cursor.h"

//dependent defines--------------------
namespace mapdisplay{
#define umapType Units::unitLib*
#define unitmap Units::unitLib::staticLib()
}

//definitions--------------------------
namespace mapdisplay{
//mapdisplay+++++++
class mapDisplay :
    public Gtk::DrawingArea,
    public Cursor::cursorServer{
public:
    //constructors------
    mapDisplay(umapType tp = NULL);
    ~mapDisplay();
    //manips------------
    void currentPlayer(int x);
    void pixSize(int wid, int hgt);
    void pixWidth(){return pixwid;}
    void pixHeight(){return pixhgt;}
    //commands----------
    bool keypress(GdkEventKey* key);
    bool buttonpress(GdkEventButton* btn);
    void center(int x, int y);
    void offset(int x, int y, int pixx, int pixy);
    void scroll(int pixx, int pixy);
    void draw();
protected:
    //listeners---------
    bool on_button_press_event(GdkEventButton* btn);
    bool on_key_press_event(GdkEventKey* key);
    bool on_expose_event(GdkEventExpose* expose);
private:
    int offsetx, offsety;
    int offsetpixx, offsetpixy;
    int pixwid, pixhgt;
    int maxx, maxy;
    umapType umap;
};
//infoDisplay++++++
class infoDisplay :
    public Gtk::VBox,
    public wSwap,
    public Cursor::cursorListener{
public:
    //constructor-------
    infoDisplay(mapDisplay* map, umapType tp = NULL);
    ~inforDisplay();
    //commands----------
    void displayFleet(Units::unit* u);
    void displayTerrain();
protected:
    //listeners---------
    void signal_curs_enter(int x, int y);
    void signal_curs_move(int x, int y);
private:
    umapType umap;
};
//controll+++++++++
class controll :
    public Gtk::HBox{
public:
    //constructor-------
    controll();
    ~control();
protected:
    //listeners--------
    bool on_key_press_event(GdkEventKey* key);
    bool on_button_press_event(GdkEventButton* btn);
private:
    infoDisplay* infdsp;
    mapDisplay* mapdsp;
};
}
#endif	/* _GAMESCR_H */

